import 'package:json_annotation/json_annotation.dart';
part 'dapp_model.g.dart';

@JsonSerializable()
class DappWalletBannerModel {
  int total;
  @JsonKey(name: "bannerTag")
  List<DappBannerTagModel>? bannerTagList;

  DappWalletBannerModel({required this.total, required this.bannerTagList});

  factory DappWalletBannerModel.fromJson(Map<String, dynamic> json) =>
      _$DappWalletBannerModelFromJson(json);

  Map<String, dynamic> toJson() => _$DappWalletBannerModelToJson(this);
}

@JsonSerializable()
class DappBannerTagModel {
  int id;
  int appId;
  String showName;
  List<DappBannerTagPositionModel>? positions;

  DappBannerTagModel(
      {required this.id,
      required this.appId,
      required this.showName,
      required this.positions});

  factory DappBannerTagModel.fromJson(Map<String, dynamic> json) =>
      _$DappBannerTagModelFromJson(json);

  Map<String, dynamic> toJson() => _$DappBannerTagModelToJson(this);
}

@JsonSerializable()
class DappBannerTagPositionModel {
  int id;
  int appId;
  String positionName;
  String advSizeHigh;
  String advSizeWide;
  int contextNum;
  double duration;
  List<DappBannerModel>? banners;

  DappBannerTagPositionModel(
      {required this.id,
      required this.appId,
      required this.positionName,
      required this.advSizeHigh,
      required this.advSizeWide,
      required this.contextNum,
      required this.duration,
      required this.banners});

  factory DappBannerTagPositionModel.fromJson(Map<String, dynamic> json) =>
      _$DappBannerTagPositionModelFromJson(json);

  Map<String, dynamic> toJson() => _$DappBannerTagPositionModelToJson(this);
}

@JsonSerializable()
class DappBannerModel {
  int id;
  int appId;
  String advName;
  String showImages;
  int eventType;
  double clickEvent;
  String pageAddress;

  DappBannerModel(
      {required this.id,
      required this.appId,
      required this.advName,
      required this.showImages,
      required this.eventType,
      required this.clickEvent,
      required this.pageAddress});

  factory DappBannerModel.fromJson(Map<String, dynamic> json) =>
      _$DappBannerModelFromJson(json);

  Map<String, dynamic> toJson() => _$DappBannerModelToJson(this);
}
